﻿@{Html.EnableClientValidation();}
@{     
    Layout = null;
    if (ViewData.TemplateInfo.TemplateDepth > 1)
    {
        if (Model == null)
        {
    @ViewData.ModelMetadata.NullDisplayText
        }
        else
        {
    @ViewData.ModelMetadata.SimpleDisplayText
        }
    }
    else
    {
    <table class="default">
        <tbody>
            @{
        foreach (var prop in ViewData.ModelMetadata.Properties.Where(pm => HtmlExtensions.ShouldShow(pm, ViewData.TemplateInfo)).OrderBy(p=>p.Order))
        {

            if (prop.HideSurroundingHtml)
            {
                @Html.Editor(prop.PropertyName)
            }
            else
            {
                <tr>
                    @{
                         
                if (!String.IsNullOrEmpty(Html.Label(prop.PropertyName).ToHtmlString()))
                {
                        <td width="30%" align="right">
                            @Html.Raw(prop.IsRequired ? "*" : "")@*@Html.Label(prop.PropertyName)*@
                            @Html.Label(prop.PropertyName, new { title = prop.Description })
                        </td>
                }
                        <td width="70%">@Html.Editor(prop.PropertyName) @Html.ValidationMessage(prop.PropertyName)<span
                            class="field-tip">@prop.Description</span>
                        </td>
                    }
                </tr>
            }

        }
            }
        </tbody>
        <tfoot>
            <tr>
                <td colspan="2" align="center">
                    <input type="submit" value="@SharedResource.Save" class="ui-state-default" />
                </td>
            </tr>
        </tfoot>
    </table>    
    }
}
@Html.EnableClientValidationJavascript()
